package mapper;

import beans.Person_Beans;
import beans.System_Beans;
import beans.Unit_Beans;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

public interface Mapper {
    /**
     * 单位开户
     * @return
     *
     * UNITACCNUM
     * UNITACCNAME
     * ACCSTATE
     * UNITKIND
     * UNITCHAR
     * BALANCE
     * BASENUMBER
     * UNITPROP
     * PERPROP
     * UNITPAYSUM
     * PERPAYSUM
     * PERSNUM
     * LASTPAYDATE
     * INSTCODE
     * CREATDATE
     */
    @Insert("insert into unit(UNITACCNUM,UNITACCNAME,ACCSTATE,UNITKIND,UNITCHAR,UNITPROP,PERPROP) values(#{UNITACCNUM},#{UNITACCNAME},'0',#{UNITKIND},#{UNITCHAR},#{UNITPROP},#{PERPROP})")
    int Unit_Add(Unit_Beans unit_beans);

    /**
     * 个人开户
     * @return
     */
    @Insert("insert into person() values()")
    int Person_Add(Person_Beans person_beans);

    /**
     *  查询当前序号
     * @param system_beans
     * @return
     */
    @Select("select SEQ from system where SEQNAME = #{SEQNAME} ")
    List<System_Beans> Select_Seq(System_Beans system_beans);


    @Update("update system set SEQ=SEQ+1 where SEQNAME = #{SEQNAME}")
    int Update_System(System_Beans system_beans);

    /**
     * 判断证件号码是否存在
     * @param person_beans 数据
     * @return 查到的数据
     */
    @Select("select * from person_details where IDNUMBER =#{IDNUMBER}")
    List<Person_Beans> Check_IDNUMBER(Person_Beans person_beans);

    /**
     * 根据公司名查询公司信息
     * @param unit_beans
     * @return
     */
    @Select("select UNITACCNAME,UNITPROP,PERPROP from unit where UNITACCNUM=#{UNITACCNUM}")
    List<Unit_Beans> Select_Unit_Message(Unit_Beans unit_beans);
}
